<template>
  <el-dialog
    :visible.sync="visible"
    :modal="false"
    v-if="visible"
    :before-close="cancel"
    :close-on-press-escape="false"
    fullscreen="true"
    center="true"
    append-to-body
    custom-class="proposal-fullscreen-textarea"
  >
    <el-input
      v-model="value"
      type="textarea"
      class="editorbox"
      resize="none"
    />
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        @click="save"
        type="primary"
      >
        保存
      </el-button>
      <el-button @click="cancel">
        取消
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'Index',
  props: {
    visible: {
      type: Boolean,
      default: () => false,
    },
    value: {
      type: String,
      default: () => '',
    },
  },
  methods: {
    save() {
      this.$emit('ok', this.value);
      this.cancel();
    },
    cancel() {
      this.visible = false;
      this.$emit('cancel');
    },
  },
};
</script>

<style lang="less">
  .proposal-fullscreen-textarea {
    .editorbox {
      > textarea {
        height: 78vh;
      }
    }
  }
</style>
